<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>  
<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Content-Language" content="zh-CN">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="shop">
    <meta name="author" content="letsun">

    <title>评价列表</title>
	<%@ include file="../init.jsp" %>
    <script src="${resources}/js/jqPaginator.min.js"></script>
    <style>
        /* 分页样式 */
        .pageBtn {
            position: absolute;
            bottom: 20px;
            border: 1px solid #ccc;
            border-radius: 5px;
            left: 50%;
            -webkit-transform: translate(-50%, 0);
            -moz-transform: translate(-50%, 0);
            -ms-transform: translate(-50%, 0);
            -o-transform: translate(-50%, 0);
            transform: translate(-50%, 0);
        }
        /* 分页样式 */
        .pageBtn li {
            width: 40px;
            height: 40px;
            float: left;
            border-right: 1px solid #ccc;
            text-align: center;
            line-height: 40px;
        }

        .pageBtn li:last-child {
            border: none;
        }

        .pageBtn .prev, .pageBtn .next {
            width: 60px;
        }

        .pageBtn .active{
            background-color: #2196F3;
            color: #fff;
        }

        #notdata{
            display: none;
            text-align: center;
            padding-bottom: 100px;
            background-color: #fff;
        }
        #notdata img{
            margin-top: 100px;
            width:150px;
        }
        #notdata p{
            color: #E6E6E6;
            font-size:18px;
            height:40px;
            line-height:40px;
        }

    </style>
    <link rel="stylesheet" href="${resources}/css/commentList.css">
</head>

<body>
<%@ include file="../header_1.jsp" %>
<div class="container">
    <div class="row">
        <div class="col-md-1">
        	<%@ include file="../menu.jsp" %>
        </div>
        <div class="col-md-11">
            <div class="mask">
                <span style="margin:auto;">
                    <i class="fa fa-spinner fa-spin"></i>
                </span>
            </div>
            <!-- page-content -->
            <div class="page-content">
                <div class="page-comm">
                   <div style="margin-top: 10px; padding-bottom: 60px; position: relative;">
                        <div class="content-list"  id="pageCon">
                   	
                   		</div>
                    </div>
                </div>
                <div  id="notdata">
                    <img  src="${resources}/images/10_1.png" alt="">
                    <p>土豪，查找不到你的评价</p>
                </div>
            </div>
            <!-- /.page-content -->


            <form id="validation-form" method="get" action="http://192.168.1.42:8888/shop-pc/manage/order/create">

            </form>
        </div>
    </div>
</div>

<%@ include file="../footer.jsp" %>
</body>
<script>
var selData = ({
	pageNumber : 1
})
    function paging(cfg) {
        var paginator = $("#pageCon");

        paginator.jqPaginator({
            totalCounts: 500,//总条目数
            pageSize: 5,//每一页显示的条目数
            visiblePages: 5,//分多少页
            currentPage: 1,//当前页数
            first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
            prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
            next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
            last: '<li class="last"><a href="javascript:void(0);">末页<\/a><\/li>',
            page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
            wrapper: '<ul class="pageBtn"></ul>',

            //页面加载和点击页码时请求数据
            onPageChange: function (num) {
            	selData.pageNumber= num;
                $.get(cfg.url,selData, function (res) {
                 if (res.msg == 0) {
                	 notdata();
               	 	 return;
                 }
                 if(res.code=="111"){
                	 notdata();
                 	 return;
                 }
                 var html = "";
                 //重新配置分页的总条目数
                 var count = -(res.msg) * (-1);
	                 paginator.jqPaginator('option', {
	                 totalCounts: count
                 });
                 for (var i = 0; i < res.result.length; i++) {
                	 var order =  res.result[i].order;
                	 html += '<div class="page-content-head">'+order.merchant.name;
               		 html += ' <a href="${path}/manage/myCenter/orderInfo/'+order.id+'" class="btn btn-default operationBtn">详情</a>';
           			 html += '</div>';
                	 var itemList = res.result[i].orderItemList;
                	 if(itemList.length>0){
                		 for (var j = 0; j < itemList.length; j++) {
                			 var item = itemList[j];
		                	   html += '<div class="list">';
		                	   html +='<div class="pageLeft">';
		                	   html += '<div class="imgBox">';
		                	   html += '<img src="'+item.goods.picurl+'">';
		                	   html +=  '</div>';
		                	   html +=  '<div class="pageLeftInfo">';
		                	   html +=  '<div class="title">'+item.goods.name+'</div>';
		                	   html +='</div>';
		                	   html += '</div>';
		                	   html += '<div class="pageRight">';
		                	   html +=    '<span>x'+item.amount+'</span>';
		                	   html +=    '<span>合计:'+item.price+'</span>';
		                	   html += '<div class="operation">';
		                	   if(item.commentstatus==1){
			                	   html +=   '<a  disabled="disabled" class="btn btn-warning">已评价</a>';
		                	   }else{
			                	   html +=   '<a href="${path}/manage/myCenter/tocomment/'+order.id+"/"+item.id+"/"+item.goods.id+'" class="btn btn-default operationBtn">评价</a>';
		                	   }
		                	   html +=  '</div>';
		                	   html +=  '</div>';
		                	   html +=  '</div>';
                		 }
                	 }
	                 }
	                 $("#pageCon").append(html);
                 });

               /*  setTimeout(function(){
                    var html = "";

                    for (var i = 0; i < 5; i++) {
                        html += '<div class="list">'+
                            '<div class="pageLeft">'+
                            '<div class="imgBox">'+
                            '<img src="${resources}/images/1_6.png">'+
                            '</div>'+
                            '<div class="pageLeftInfo">'+
                            '<div class="title">Anchor安佳100%新西兰纯牛奶250ML</div>'+
                        '</div>'+
                        '</div>'+
                        '<div class="pageRight">'+
                            '<span>x1</span>'+
                            '<span>合计:199.0</span>'+
                        '<div class="operation">'+
                            '<a href="javascript:" class="btn btn-default operationBtn">评价</a>'+
                           '</div>'+
                            '</div>'+
                            '</div>';
                    }

                    $("#pageCon").append(html);
                },30); */

            }
        });
    }
    paging({url: "${path}/manage/myCenter/orderData?status=7"});
    function notdata() {
        $(".page-comm").hide();
        $("#notdata").show();
    }
</script>
</html>